import axios from "axios";
import qs from 'qs'
axios.defaults.baseURL = "https://autumnfish.cn"

let instance = axios.create({
    timeout: 5000
})
let request = function({ method, url, arg, }) {
    console.log(arg);
    let data = ""
    if (method.toLowerCase() == 'get') {

        instance.defaults['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
        if (arg) {
            url = url + "?" + qs.stringify(arg);
        }
    }

}


// return new Promise((resolve, reject) => {
//     instance({
//         method,
//         url,
//         data
//     }).then(res => {
//         resolve(res);
//     }).catch(err => {
//         reject(err)
//     })
// })



export default request